package org.innovasix.educational.javap.domain.constantpool;

import org.innovasix.educational.javap.domain.datatypes.cp_info;
import org.innovasix.educational.javap.domain.datatypes.u1;
import org.innovasix.educational.javap.domain.datatypes.u2;
import org.innovasix.educational.javap.domain.datatypes.u4;
import org.innovasix.educational.javap.domain.parser.ByteQueue;

/**
 * <p>
 * <b><i>From the JVM specification:</i></b><br/>
 * The CONSTANT_Long_info structure is used to represent a 8-byte numeric constant.
 * interface.
 * </p>
 * 
 * @see <a
 *      href="http://docs.oracle.com/javase/specs/jvms/se7/html/jvms-4.html#jvms-4.4.1">4.4.1.
 *      The CONSTANT_Class_info Structure</a>
 * 
 * @author sven.mentl@gmail.com
 * 
 */
public class CONSTANT_Long_info extends cp_info {

	public CONSTANT_Long_info(ByteQueue byteQueue) {
		high_bytes = byteQueue.pollFourBytes(CONSTANT_Long_info.class.getCanonicalName());
		low_bytes = byteQueue.pollFourBytes(CONSTANT_Long_info.class.getCanonicalName());
	}

	/**
	 * <p>
	 * <b><i>From the JVM specification:</i></b><br/>
	 * The tag item has the value CONSTANT_Long(5).
	 * </p>
	 */
	final u1 tag = new u1(ConstantPoolTags.CONSTANT_Long.decimalValue());

	/**
	 * <p>
	 * <b><i>From the JVM specification:</i></b><br/>
	 * The unsigned high_bytes and low_bytes items of the CONSTANT_Long_info structure together represent the value of the long constant
	 * 
	 * ((long) high_bytes << 32) + low_bytes
	 * 
	 * where the bytes of each of high_bytes and low_bytes are stored in big-endian (high byte first) order.
	 * </p>
	 */
	u4 high_bytes;
	
	/**
	 * <p>
	 * <b><i>From the JVM specification:</i></b><br/>
	 * The unsigned high_bytes and low_bytes items of the CONSTANT_Long_info structure together represent the value of the long constant
	 * 
	 * ((long) high_bytes << 32) + low_bytes
	 * 
	 * where the bytes of each of high_bytes and low_bytes are stored in big-endian (high byte first) order.
	 * </p>
	 */
	u4 low_bytes;

}
